/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import com.sun.javafx.css.SizeUnits;
import java.math.BigInteger;
import java.sql.ResultSet;
import java.sql.SQLException;
import module.Student;
import org.springframework.jdbc.core.RowMapper;

/**
 *
 * @author 黑猫
 */
public class MyRowMapper implements  RowMapper<Student>{

    @Override
    public Student mapRow(ResultSet rs, int i) throws SQLException {
        String id = rs.getString("id");
        String name = rs.getString("name");
        String gender = rs.getString("gender");
        String bir = rs.getString("birthday");
        double math = rs.getDouble("math");
        double java = rs.getDouble("java");
        double sport = rs.getDouble("sports");
        double totalScore = math+java+sport;
        
        Student stu = new Student(id, name, gender, bir, math, java, sport, totalScore);
        return stu;
    }
    
}
